layui.use(['layer','table','form'], function(args){
    var layer = layui.layer;
});

function completeTask(id) {
    var loadIndex = layer.load(2);
    $.ajax({
        type: 'POST',
        url: 'task/complete.do',
        data: {id:id},
        dataType: 'json',
        success: function (data, textStatus) {
            layer.close(loadIndex);
            layer.alert(data.message,function (index) {
                layer.close(index);
                if (data.success) {
                    location.reload();
                }
            });
        }
    })
}
